extends CharacterBody2D

@export var max_tilt_angle :int =45
@export var min_tilt_angle :int =-45
@export var climb_speed :int = 300
@onready var helicopter_animation: AnimatedSprite2D = $AnimatedSprite2D
@onready var manbo: AudioStreamPlayer = $manbo

func _ready() -> void:
	#开始播放牢大动画
	helicopter_animation.play()
	
#牢大运动方法
func _physics_process(delta: float) -> void:

	if not is_on_floor():
		velocity.y += Gs.gravity * delta
		var tilt_angle :int  = clamp((velocity.y/Gs.gravity)*max_tilt_angle,min_tilt_angle,max_tilt_angle)
		self.rotation_degrees = tilt_angle
	#将移动加至牢大
	move_and_slide()

func _unhandled_input(event: InputEvent) -> void:
	if event.is_action_pressed("slap"):
		self.velocity.y -= climb_speed
		
